package org.JWCB.friend.controller.user;


import org.JWCB.common.core.controller.BaseController;
import org.JWCB.common.core.domain.vo.R;

import org.JWCB.friend.domain.user.dto.UserSubmitDto;
import org.JWCB.api.domain.judge.vo.UserQuestionResVo;
import org.JWCB.friend.service.user.UserQuestionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;


@RestController
@RequestMapping("user/question")
public class UserQuestionController extends BaseController {


    private static final Logger log = LoggerFactory.getLogger(UserQuestionController.class);
    @Autowired
    private UserQuestionService userQuestionService;
    @PostMapping("submit")
    public R<UserQuestionResVo> submit(@RequestBody @Validated UserSubmitDto userSubmitDto) {
        return userQuestionService.submit(userSubmitDto);
    }


    @PostMapping("mq/submit")
    public R<String> mQSubmit(@RequestBody @Validated UserSubmitDto userSubmitDto) {
        return R.ok(userQuestionService.mQSubmit(userSubmitDto));
    }


    @GetMapping("exeResult")
    public R<UserQuestionResVo> exeResult(Long examId, Long questionId, String uniqueId) {
        return  R.ok(userQuestionService.exeResult(examId,questionId,uniqueId));
    }
}
